﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using WordService.Business.IBLL;
using WordService.Business;

namespace WordLib.ConfigUI
{
    public partial class RightRatePanel : UserControl
    {
        public RightRatePanel()
        {
            InitializeComponent();
            LoadForm();
        }

        private IFileBLL fileBLL = BLLManager.CreateFileBLL();

        private void LoadForm()
        {
            IDictionary<String, Decimal> map = fileBLL.GetKeywordRate();
            Decimal keywordValue = new Decimal();
            map.TryGetValue("SAME", out keywordValue);
            this.txtSame.Text = keywordValue.ToString();
            map.TryGetValue("TITLE", out keywordValue);
            this.txtTitle.Text = keywordValue.ToString();
            map.TryGetValue("SUMMARY", out keywordValue);
            this.txtSummary.Text = keywordValue.ToString();
            map.TryGetValue("NONE", out keywordValue);
            this.txtNone.Text = keywordValue.ToString();

            IDictionary<Int32, Decimal> resultMap = fileBLL.GetAuthorRate();
            foreach (Int32 key in resultMap.Keys)
            {
                Decimal authorValue = new Decimal();
                resultMap.TryGetValue(key,out authorValue);
                this.lbAuthor.Items.Add(key.ToString() + "【" + authorValue + "】");
            }
        }
    }
}
